package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Settings;
import com.tanhua.dubbo.mapper.SettingsMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class SettingsApiImpl implements SettingsApi {

    @Autowired
    private SettingsMapper settingsMapper;

    //根据userId查询通用设置
    @Override
    public Settings findByUserId(Long id) {
        QueryWrapper<Settings> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_id",id);
        return settingsMapper.selectOne(queryWrapper);

    }

    //根据id更新
    @Override
    public void update(Settings settings1) {

        settingsMapper.updateById(settings1);
    }

    //保存
    @Override
    public void save(Settings settings) {

        settingsMapper.insert(settings);
    }
}
